# -*- coding: utf-8 -*-

# 爬虫起始名字
BOT_NAME = 'scl_spider'

# Scrapy将寻找爬虫的模块列表
SPIDER_MODULES = ['scl_spider.spiders']

# 模块在哪里使用genspider命令创建新的爬虫
NEWSPIDER_MODULE = 'scl_spider.spiders'

# 自定义命令
COMMANDS_MODULE = 'scl_spider.commands'

# 数据库配置
# MongoDB数据库地址
# MONGODB_HOST = '120.77.153.78'
MONGODB_HOST = '192.168.31.154'

# MongoDB数据库端口
# MONGODB_PORT = 10086
MONGODB_PORT = 27017

# MongoDB数据库名称
# MONGODB_NAME = 'SCL_learning_data'
MONGODB_NAME = 'campusplatform'

# MongoDB数据库用户名 (权限DBOwner)
MONGODB_USER = 'root'

# MongoDB数据库密码
MONGODB_PWD = 'scl.data!@#root'

# 配置Scrapy最大并发请求量(默认貌似是16个)
# CONCURRENT_REQUESTS = 32

# 下载延迟(请求延迟)
# DOWNLOAD_DELAY = 1

# 对任何单个域执行的并发请求的最大数量。
# CONCURRENT_REQUESTS_PER_DOMAIN = 16

# 对任何单个IP执行的并发请求的最大数量
# CONCURRENT_REQUESTS_PER_IP = 16

# Cookies的开关
COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False

# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#   'Accept-Language': 'en',
#}

# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    'scl_spider.middlewares.SclSpiderSpiderMiddleware': 543,
#}

# 开启下载中间件
DOWNLOADER_MIDDLEWARES = {
    'scl_spider.middlewares.RotateUserAgentMiddleware': 300,
    'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': None,

}


# 配置实体类管道(item-pipelines)
ITEM_PIPELINES = {
   'scl_spider.pipelines.SclSpiderPipeline': 300,
}

# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
